import sys
import os
import traceback
+import re
def log(_, msg):
#print "> " + msg
= get_child_by_name(vbd_sxp, "mode") != "w" \
and "RO" or "RW"
vbd.attributes["device"] \
- = get_child_by_name(vbd_sxp, "dev")
+ = re.sub(":cdrom$", "", get_child_by_name(vbd_sxp, "dev"))
vbd.attributes["bootable"] = "1"
- vbd.attributes["type"] = "disk"
+ vbd.attributes["type"] \
+ = re.search(":cdrom$", get_child_by_name(vbd_sxp, "dev")) \
+ and "CD" or "disk"
vbd.attributes["qos_algorithm_type"] = ""
return vbd